<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>My JSP 'welcome.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="text/javascript" src="../js/jquery-1.8.2.js"></script>
	<script type="text/javascript">
	$(function(){	
		$('#btn').bind('click',function(){
			alert("123");
			$.ajax({
			    type : "post",
			    dataType : "json",
			    url : "testJson1.do",
			    data:{
			        name:"韦德",
			        age:35
			    },
			    success : function(result) {
			    	console.log("re:"+result);
			    }
			});
		});
		
		
		$('#btn2').bind('click',function(){
			alert("1232");
			console.log("j:"+JSON.stringify({
		        name:"韦德",
		        win:[2006,2012,2013],
		        age:35
		    }));
			$.ajax({
			    type : "post",
			    contentType:"application/json",  
			    dataType : "json",
			    url : "testJson2.do",
			     
			    data:JSON.stringify({
			        name:"韦德",
			        win:[2006,2012,2013],
			        age:35
			    }),
			    success : function(result) {
			    }
			});
		});
		
		
		$('#btn3').bind('click',function(){
			alert("1233");
			$.ajax({
			    type : "post",
			    dataType : "json",
			    url : "testJson3.do",
			    success : function(result) {
			    	console.log('%O',result);
			    }
			});
		});
	}); 
	</script>
  </head>
  
  <body>
    This is my JSP page. <br>
    welcome!
    <br>
    <input id="btn" type="button" value="ajaxTest">
	<br>
	<input id="btn2" type="button" value="ajaxTest2">
	<br>
	<input id="btn3" type="button" value="ajaxTest3">
  </body>
</html>
